home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / dvibook / libtex / types.h < prev   
C/C++ Source or Header  |  1994-03-18  |  3KB  |  108 lines

  1. /*
  2.  * Copyright (c) 1987, 1989 University of Maryland
  3.  * Department of Computer Science.  All rights reserved.
  4.  * Permission to copy for any purpose is hereby granted
  5.  * so long as this copyright notice remains intact.
  6.  */
  7.  
  8. /*
  9.  * MC-TeX types and macros (system dependent).
  10.  * Check to make sure they are correct for your system.
  11.  */
  12.  
  13. #ifndef _MCTEX_TYPES_
  14. #define _MCTEX_TYPES_
  15.  
  16. /*
  17.  * Define void as int if your compiler does not support void,
  18.  * or if there are bugs in its support (e.g., 4.1BSD).
  19.  */
  20. /* #define void int */
  21.  
  22. /*
  23.  * Define the following if and only if vfprintf is in your C library.
  24.  * If not, lib/error.c will make assumptions about the implementation
  25.  * of stdio.  If neither works, you may have to come up with something
  26.  * yourself.
  27.  */
  28. #define HAVE_VPRINTF
  29.  
  30. /*
  31.  * Define BSD_FILE_SYSTEM if you have the BSD file system `stat'
  32.  * structure (with the st_blksize field).  Otherwise, MakeSeekable()
  33.  * will be slower than necessary.
  34.  */
  35. #define BSD_FILE_SYSTEM
  36.  
  37. /*
  38.  * Define this as the name of a routine that handles overlapping block
  39.  * copies, if there is such a routine.  Usually it will be called memmove()
  40.  * but on 4.3BSD it is called bcopy().  Note that the 4.2BSD bcopy() does
  41.  * not handle overlap, and must not be used here.  If there is no routine,
  42.  * or if its overlap handling is uncertain, leave BLOCK_COPY undefined.
  43.  *
  44.  * (The bcopy provided in lib/bcopy.c does handle overlap.)
  45.  */
  46. /* #define BLOCK_COPY(from, to, len) memmove(to, from, len) */
  47. #define BLOCK_COPY(from, to, len) bcopy(from, to, len)
  48.  
  49. /*
  50.  * If you have memcpy/memmove, but not bcopy, use the definition below.
  51.  * If you have neither, try the bcopy provided in lib/bcopy.c.
  52.  */
  53. /* #define bcopy(from, to, len) memcpy(to, from, len) */
  54.  
  55. /*
  56.  * If you have memcmp, but not bcmp, use the definition below.
  57.  * If you have neither, try the bcmp provided in lib/bcmp.c.
  58.  */
  59. /* #define bcmp(s1, s2, len) memcmp(s1, s2, len) */
  60.  
  61. /*
  62.  * Define the following types and macros as required by your system.
  63.  */
  64.  
  65. typedef short i16;        /* a 16 bit integer (signed) */
  66.  
  67. typedef long i32;        /* a 32 bit integer (signed) */
  68. typedef unsigned long ui32;    /* a 32 bit integer (unsigned) */
  69.  
  70. /* macros to sign extend quantities that are less than 32 bits long */
  71.  
  72. /* these compilers mishandle (int)(char)(constant), but a subterfuge works */
  73. #if defined(sun) || defined(hp300)
  74. #define Sign8(n)    ((i32)(char)(int)(n))
  75. #endif
  76.  
  77. /* these have signed characters and (int)(char)(constant) works */
  78. #if defined(vax) || defined(mips)
  79. #define    Sign8(n)    ((i32)(char)(n))
  80. #endif
  81.  
  82. /* this works everywhere, but may be slow */
  83. #ifndef    Sign8
  84. #define Sign8(n)    ((n) & 0x80 ? ((n) | ~0xff) : (n))
  85. #endif
  86.  
  87. /* this should work everywhere */
  88. #ifndef Sign16
  89. #define Sign16(n)    ((i32)(i16)(n))
  90. #endif
  91.  
  92. /* this works where int is 32 bits, and >> sign extents and is fast */
  93. #if defined(vax) || defined(mips)
  94. #define    Sign24(n)    (((n) << 8) >> 8)
  95. #endif
  96.  
  97. /* this works everywhere, but may be slow */
  98. #ifndef    Sign24
  99. #define    Sign24(n)    ((n) & 0x800000 ? ((n) | ~0xffffff) : (n))
  100. #endif
  101.  
  102. /* macros to truncate quantites that may be signed */
  103. #define UnSign8(n)    ((i32)(n) & 0xff)
  104. #define UnSign16(n)    ((i32)(n) & 0xffff)
  105. #define UnSign24(n)    ((i32)(n) & 0xffffff)
  106.  
  107. #endif /* _MCTEX_TYPES_ */
  108.